package main.java;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

import com.opensymphony.xwork2.Action;

public class LoginAction implements Action {
	private String user;
	private String pass;
	private InputStream inputStream;

	// user属性的setter和getter方法
	public void setUser(String user) {
		this.user = user;
	}

	public String getUser() {
		return this.user;
	}

	// pass属性的setter和getter方法
	public void setPass(String pass) {
		this.pass = pass;
	}

	public String getPass() {
		return this.pass;
	}

	public InputStream getResult() {
		return inputStream;
	}

	public String execute() throws Exception{
			inputStream = user.equals("leifchen")&&pass.equals("chen1990")
					? new ByteArrayInputStream("恭喜您，登录成功！".getBytes("UTF-8"))
							:new ByteArrayInputStream("对不起，用户名、密码不匹配！".getBytes("UTF-8"));
					return SUCCESS;
		}
}
